package com.example.finalapplication;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class MineAdapterThree extends ArrayAdapter {


    public MineAdapterThree(@NonNull Context context, int resource, @NonNull ArrayList<HashMap<String, String>> objects) {
        super(context, resource, objects);
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        View itemView = convertView;
        if (itemView == null) {
            itemView = LayoutInflater.from(getContext()).inflate(R.layout.item_three,
                    parent,
                    false);

        }

        Map<String, String> map = (Map<String, String>) getItem(position);

        TextView city = (TextView) itemView.findViewById(R.id.city);
        TextView two = (TextView) itemView.findViewById(R.id.two);
        TextView five = (TextView) itemView.findViewById(R.id.five);
        TextView eight = (TextView) itemView.findViewById(R.id.eight);
        TextView zero = (TextView) itemView.findViewById(R.id.zero);
        city.setText("中文名" + map.get("city"));
        two.setText("外文名" + map.get("two"));
        five.setText("科" + map.get("five"));
        eight.setText("纲" + map.get("eight"));
        zero.setText("纲" + map.get("zero"));
        return itemView;
    }
}